#pragma once
class FrameBuffer
{
public:
	FrameBuffer();
	~FrameBuffer();
    void resize(int width, int height, int Len);
    uint8_t* getCurrentBuffer();
    void swapBuffers();
    int getAvailableBuffer(char** data, int* len, int* w, int* h,int block);
    void activateAll();
private:
    int _width=0;
    int _height=0;
    int _len=0;
    int _lenMax = 0;
    uint8_t* _buffers[3];
    int _currentBuffer = 0;
    int _lastRetrievedBuffer = 0;
    std::atomic_bool _resized = false;
    std::atomic_bool _updated = false;
    std::atomic_bool _moved = true;

    std::mutex _mutex;
    std::condition_variable _condVar;
};

